import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/components/Login.vue'
import Home from '@/components/Home.vue'
import GameHall from '@/components/gamehall/GameHall.vue'
import Room from '@/components/room/Room.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login',
    },
    {
      path: '/login',
      name: 'login',
      component: Login,
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      redirect: '/gamehall',
      children: [
        {
          path: '/gamehall',
          name: 'gamehall',
          component: GameHall,
        },
      ],
    },
    {
      path: '/room/:id',
      name: 'room',
      component: Room,
    },
  ],
})

export default router
